package com.htfyun.javatest;

import java.util.ArrayList;
import java.util.List;

public class MyJavaTest {

    public static void main(String args[]) {
        System.out.println("Hello World!");
        testList();
    }

    private static void testList() {

        List<String> wl = new ArrayList<>();
        wl.add("com.android.settings");
        wl.add("com.android.camera");
        wl.add("com.android.launcher");
        wl.add("com.android.recorder");
        wl.add("com.android.gallery");

//        String sn = "";
        StringBuilder sb = new StringBuilder("");
        int count = 0;
        for (String pn : wl) {

            if (sb.length() + pn.length() + 1 >= 60) {
                if (sb.length() > 0) {
                    System.out.println("count = " + count + ", sn = " + sb.toString());
                    count++;
                }
                sb = new StringBuilder("");
            }
            sb.append(pn);
            sb.append(";");
        }
        if (sb.length() > 0) {
            System.out.println("22 count = " + count + ", sn = " + sb.toString());
            count++;
        }

        System.out.println("33 count = " + count);

    }
}
